/*
 * Eugen Stoian <stoian.e@gmail.com> 2010
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef MATHPARSER_GLOBAL_H
#define MATHPARSER_GLOBAL_H

#include <QtCore/qglobal.h>
#include <Real.h>

int yyparse();
void yyset_in(FILE*);
int yy_scan_string(const char*);

#if defined(MATHPARSER_LIBRARY)
#  define MATHPARSERSHARED_EXPORT Q_DECL_EXPORT
#else
#  define MATHPARSERSHARED_EXPORT Q_DECL_IMPORT
#endif

typedef Real (*MathUnaryFun)(const Real&);

typedef Real (*MathBinaryFun)(const Real&, const Real&);

#define FUNCALL_PRECEDENCE 10

#define MINUS_SYMBOL "-"
#define MINUS_PRECEDENCE 8

#define PLUS_SYMBOL "+"
#define PLUS_PRECEDENCE 8

#define POW_SYMBOL "^"
#define POW_PRECEDENCE 9

#define MUL_SYMBOL "*"
#define MUL_PRECEDENCE 7

#define DIV_SYMBOL "/"
#define DIV_PRECEDENCE 7

#define ADD_SYMBOL "+"
#define ADD_PRECEDENCE 6

#define SUB_SYMBOL "-"
#define SUB_PRECEDENCE 6

#define LT_SYMBOL  "<"
#define LT_PRECEDENCE 5

#define LE_SYMBOL "<="
#define LE_PRECEDENCE 5

#define GT_SYMBOL ">"
#define GT_PRECEDENCE 5

#define GE_SYMBOL ">="
#define GE_PRECEDENCE 5

#define EQ_SYMBOL "=="
#define EQ_PRECEDENCE 5

#define NE_SYMBOL "!="
#define NE_PRECEDENCE 5

#define AND_SYMBOL "&"
#define AND_PRECEDENCE 4

#define OR_SYMBOL "|"
#define OR_PRECEDENCE 3

#define IF_SYMBOL ":"
#define IF_PRECEDENCE 2

#define ELSE_SYMBOL ";"
#define ELSE_PRECEDENCE 1

#define DEFAULT_PRECEDENCE 0
#endif // MATHPARSER_GLOBAL_H
